.\" Copyright (c) 2004-2007 Apple Inc. All rights reserved.
.Dd December 31, 2007
.Dt PTHREAD_ATTR 3
.Os
.Sh NAME
.Nm pthread_attr_getschedparam ,
.Nm pthread_attr_setschedparam
.Nd thread attribute operations
.Sh SYNOPSIS
.Fd #include <pthread.h>
.Ft int
.Fo pthread_attr_getschedparam
.Fa "const pthread_attr_t *restrict attr"
.Fa "struct sched_param *restrict param"
.Fc
.Ft int
.Fo pthread_attr_setschedparam
.Fa "pthread_attr_t *restrict attr"
.Fa "const struct sched_param *restrict param"
.Fc
.Sh DESCRIPTION
Thread attributes are used to specify parameters to
.Fn pthread_create .
One attribute object can be used in multiple calls to
.Fn pthread_create ,
with or without modifications between calls.
.Pp
.Fn pthread_attr_getschedparam
and
.Fn pthread_attr_setschedparam
get and set the scheduling parameters within the 
.Fa attr
argument. See
.Fd /usr/include/sched.h
for the definition of 
.Fa struct sched_param . 
The 
.Fa sched_priority
field of
.Fa struct sched_param
must be within the range returned by the
.Xr sched_get_priority_min 2
and
.Xr sched_get_priority_max 2
system calls.
.Sh RETURN VALUES
If successful, these functions return 0.
Otherwise, an error number is returned to indicate the error.
.Fn pthread_attr_getschedparam ,
on success, will copy the value of the thread's scheduling parameter attribute
to the location pointed to by the second function parameter.
.Sh ERRORS
.Pp
.Fn pthread_attr_getschedparam
will fail if:
.Bl -tag -width Er
.\" ========
.It Bq Er EINVAL
Invalid value for
.Fa attr .
.\" ========
.El
.Pp
.Fn pthread_attr_setschedparam
will fail if:
.Bl -tag -width Er
.\" ========
.It Bq Er EINVAL
Invalid value for
.Fa attr .
.\" ========
.It Bq Er ENOTSUP
Invalid value for
.Fa param .
.El
.Sh SEE ALSO
.Xr pthread_create 3 ,
.Xr pthread_attr_init 3 ,
.Xr pthread_attr_setinheritsched 3 
.Sh STANDARDS
.Pp
.Fn pthread_attr_setschedparam ,
.Fn pthread_attr_getschedparam 
conform to
.St -susv2
